﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Data.Core
{
    /// <summary>
    /// 统一操作规范
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public interface IRepository
    {
        /// <summary>
        /// 得到简单结果集
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <returns></returns>
        IQueryable<TEntity> GetEntities<TEntity>() where TEntity : class;
        /// <summary>
        /// 插入实体
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entity"></param>
        void Insert<TEntity>(TEntity entity) where TEntity : class;
        /// <summary>
        /// 插入列表
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entities"></param>
        void Insert<TEntity>(List<TEntity> entities) where TEntity : class;
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entity"></param>
        void Delete<TEntity>(TEntity entity) where TEntity : class;
        /// <summary>
        /// 删除列表
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entities"></param>
        void Delete<TEntity>(List<TEntity> entities) where TEntity : class;
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entity"></param>
        void Update<TEntity>(TEntity entity) where TEntity : class;
        /// <summary>
        /// 更新列表
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entities"></param>
        void Update<TEntity>(List<TEntity> entities) where TEntity : class;
    }
}
